<!DOCTYPE html>
<html lang="en">

<head>
    <meta charset="UTF-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Document</title>
</head>

<body>
    <button class="img_1">1</button>
    <button class="img_2">2</button>
    <img src="/Users/humeng/Pictures/2022.03.01.10.14.jpg" alt="1" title="1" height="500px" width="500px">

    <script>
        var img1 = document.querySelector('.img_1');
        var img2 = document.querySelector('.img_2');
        var img = document.querySelector('img');
        //注册事件
        img2.onclick = function () {
            img.src = '/Users/humeng/Pictures/IMG_8484(20220301-105418).JPG';
            img.title = '2';
        }
        img1.onclick = function () {
            img.src = '/Users/humeng/Pictures/2022.03.01.10.14.jpg';
            img.title = '1';
        }
    </script>
</body>

</html>